package com.miyake.dsp.ui;

import java.util.ArrayList;
import java.util.List;

import javax.swing.JLabel;
import javax.swing.JPanel;

public abstract class DspWidget extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 3957891624367706049L;
	protected static final int WIDGET_HIGHT = 25;
	
	public interface DspWidgetHandler {
		void onChange(String value);
	}
	
	private List<DspWidgetHandler> handlers = new ArrayList<DspWidgetHandler>();
	
	public void addHandler(DspWidgetHandler h) {
		handlers.add(h);
	}
	
	protected void fireChange(String s) {
		for (DspWidgetHandler h : handlers) {
			h.onChange(s);
		}
	}
	
	protected void setTitle(String title) {
		this.add(new JLabel(title));
	}
}
